package com.dmz.workflow.util;

import java.util.*;

public class ObjectUtils {

    public static boolean isNotEmpty(Object object) {
        return !isEmpty(object);
    }

    @SuppressWarnings("rawtypes")
    public static boolean isEmpty(Object object) {
        if (object == null) {
            return true;
        }
        if (object == "") {
            return true;
        }
        if (object instanceof String) {
            return ((String) object).length() == 0;
        } else if (object instanceof Collection) {
            return ((Collection) object).size() == 0;
        } else if (object instanceof Map) {
            return ((Map) object).size() == 0;
        }
        return false;
    }

    public static boolean validateCollectionIsEmpty(Object object) {
        return null == object || ((Collection) object).isEmpty() || ((Collection) object).size() == 0;
    }
}